/*
 * @Author: 杨光辉(GerhardYang)
 * @Date: 2021-06-06 17:30:49
 * @LastEditors: 何鹏程(hepch)
 * @LastEditTime: 2021-06-15 12:27:25
 * @Description: file content
 * @Copyright: 超图软件华中平台客户中心 (SuperMap Software Co., Ltd. -Central China Platform)
 */

const resize = () => {
  const e = document.createEvent("HTMLEvents");
  e.initEvent("resize", true, true);
  window.dispatchEvent(e);
};

const showRightMenu = () => {
  document.getElementById("map").style.right = "350px";
  document.getElementsByClassName("cd-side-navigation")[0].style.right =
    "300px";
  document.getElementById("maptools").style.right = "360px";
  resize();
};
const hideRightMenu = () => {
  document.getElementById("maptools").style.right = "60px";
  document.getElementById("map").style.bottom = "1px";
  document.getElementById("basemap").style.bottom = "15px";
  document.getElementById("map").style.right = "50px";
  document.getElementsByClassName("cd-side-navigation")[0].style.right = "0px";
  resize();
};

const hideBottomPanel = () => {
  document.getElementById("map").style.bottom = "1px";
  document.getElementById("basemap").style.bottom = "15px";
  document.getElementsByClassName("legend-content")[0].style.maxHeight =
    400 + "px";
  resize();
};
const showBottomPanel = () => {
  document.getElementById("map").style.bottom = "355px";
  document.getElementById("basemap").style.bottom = 355 + 15 + "px";
  document.getElementsByClassName("legend-content")[0].style.maxHeight =
    180 + "px";
  resize();
};

export { showRightMenu, hideRightMenu, hideBottomPanel, showBottomPanel };
